/*
 * @Author: 张小平
 * @Date:   2025-05-01 
 * @Email:  qqshuqian@163.com 
 * @Copyright © 2024 aseyun. All rights reserved.
 */
import taskAPI from '@/framework-code/api/task'

const formProperty = {
  data() {
    return {
      fromPropertyList: []
    }
  },
  mounted() {
    if (this.item?.properties?.fromPropertyList) {
      this.fromPropertyList = this.item.properties.fromPropertyList
    } else {
      const procId = this.procId
      if (procId) {
        this.formPropertyList(procId)
      }
    }
  },
  methods: {
    async formPropertyList(procId) {
      try {
        const { code, data } = await taskAPI.apiFormPropertyList({ procId })
        this.fromPropertyList = data.data.data;
      } catch (err) {
        this.$message.error(err.msg)
      }
    },
    handleFormList(newList) {
      if (newList.length) {
        this.item.properties.fromPropertyList = newList

        // this.$emit('on-item', this.item)
      }
    }
  }
}

export default formProperty
